package org.hyh.autowired;

import org.springframework.aop.framework.AopContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;

/**
 * @auther :hyh
 * @desc :
 * @date :2019/11/30
 */

public class User  implements  U {
    private   String   abc;

	@Resource
	private   Student student;

	@Autowired
	private  Teacher teacher;
	public User() {
		System.out.println("user .......");
	}

    @TestAdmin
	public String  testAspectJ(){
		System.out.println("目标方法的实现。");

//		int a = 10 / 0;
		User o = (User) AopContext.currentProxy();
		 o.testa();
		return  1+"";
	}


	public String getAbc() {
		return abc;
	}

	public void setAbc(String abc) {
		this.abc = abc;
	}


	@PostConstruct
	public   void  init(){
		System.out.println("init......");
	}

	 @PreDestroy
	public  void  destory(){
		 System.out.println("before ... destory...");
	 }

	 @TestAdmin
	 public void  testa(){
		 System.out.println("测试方法内部调用是否失效");
	 }



}
